Skip to content

Issue #47 and other#74

Merged
Linked-Liszt merged 2 commits into
mainfrom
47-add-input-validation-and-add-header-in-recon-page
Oct 20, 2025
Merged

Issue #47 and other#74
Linked-Liszt merged 2 commits into
mainfrom
47-add-input-validation-and-add-header-in-recon-page

Conversation

@matthewrdiamond

Copy link
Copy Markdown
Collaborator
  • Added input validation, including helper functions
  • Added load_file_indices callback
  • Updated check_filenames to populate the field

- Added load_file_indices callback
- Updated check_filenames to populate the field
@matthewrdiamond matthewrdiamond linked an issue Oct 17, 2025 that may be closed by this pull request
@matthewrdiamond

Copy link
Copy Markdown
Collaborator Author
# Wire Reconstruction Validation Checks

This document lists all validation checks performed by `validate_wire_reconstruction_inputs` in `create_wire_reconstruction.py`.

## Global Parameter Validation

### 1. Root Path
- Root path is required (empty or None)
- Root path directory exists (directory does not exist at path)

### 2. Data Path
- Data path is required (empty or None)
- Data path parsing succeeds (parse_parameter raises ValueError)

### 3. All Other Parameters
For each parameter: `filenamePrefix`, `scanPoints`, `geoFile`, `depth_start`, `depth_end`, `depth_resolution`, `percent_brightest`, `outputFolder`, `scanNumber`, `wire_edges`, `author`

- Parameter is not missing/empty (value is None, empty string, or falsy except 0 for numeric fields)
- Parameter parsing succeeds (parse_parameter raises ValueError)
- Parameter count matches number of inputs (parsed list length ≠ number of data paths)

**Note**: `scanNumber` generates warnings instead of errors for all checks

## Per-Input Validation

### 4. Depth Parameters
- Depth start is required (empty for this input)
- Depth start is valid number (cannot convert to float)
- Depth end is required (empty for this input)
- Depth end is valid number (cannot convert to float)
- Depth resolution is required (empty for this input)
- Depth resolution is valid number (cannot convert to float)
- Depth start < depth end (depth_start ≥ depth_end)
- Large depth range warning (depth_end - depth_start > 500 µm)
- Depth resolution is positive (depth_resolution ≤ 0)
- Very small depth resolution warning (depth_resolution < 0.1 µm)
- Depth resolution < depth range (depth_resolution > |depth_end - depth_start|)

### 5. Intensity Percentile
- Intensity percentile is required (empty for this input)
- Intensity percentile is valid number (cannot convert to float)
- Intensity percentile in valid range (value ≤ 0 or > 100)

### 6. Geometry File
- Geometry file is required (empty for this input)
- Geometry file exists (file does not exist at root_path/geoFile)

### 7. Output Folder
- Output folder is required (empty for this input)
- Output folder already exists warning (directory exists at root_path/outputFolder, skipped if contains %d)

### 8. Data Files
- Data directory exists (directory does not exist at root_path/data_path)
- Data directory contains files (directory exists but contains no files)
- Catalog path matches warning (catalog database has different path for this scan number)
- Files match prefix pattern (no files match filenamePrefix pattern with wildcard substitution)
- Files match specific scan points (files missing for specific scan point numbers in scanPoints)
- Invalid scan points format (srange parsing fails for scanPoints)

### 9. Scan Number
- Scan number is valid integer warning (cannot verify .isdigit())

## Summary

**Total Checks**: ~30 global + ~25 per input

**Result Structure**:
```python
{
    'heading': str,  # "Validation Error!" | "Validation Warning!" | "Validation Success!"
    'errors': list,
    'warnings': list,
    'field_highlights': dict  # {field_id: 'error'|'warning'}
}

Special Cases:

  • scanNumber: All failures are warnings (non-blocking)
  • outputFolder: Existence check skipped if contains %d placeholder
  • Early return on data_path parsing failure
  • Multiple inputs: Checks run per input with "Input {i+1}:" prefix

@matthewrdiamond

Copy link
Copy Markdown
Collaborator Author

scanNumber has hard-coded exemptions (warnings instead of errors)

@matthewrdiamond

Copy link
Copy Markdown
Collaborator Author

Also, a missing '*' was added to the glob call to find for matching files in submit_parameters().

@Linked-Liszt Linked-Liszt merged commit 023b01c into main Oct 20, 2025
1 check passed
@Linked-Liszt Linked-Liszt deleted the 47-add-input-validation-and-add-header-in-recon-page branch December 16, 2025 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Input Validation and Add Header in Recon Page

2 participants